In the packaging of integrated circuits, a plurality of device dies may be bonded on an interposer wafer, which includes a plurality of interposers therein. The interposers include Through-Silicon Vias (TSVs). After the bonding of the device dies, an underfill is dispensed into the gaps between the device dies and the interposer wafer. A curing process may then be performed to cure the underfill. A molding compound can be applied to encapsulate the device dies therein. The resulting interposer wafer and the top dies thereon are then sawed apart into a plurality of packages, with the packages including exposed electrical connectors such as solder balls. The packages are then bonded to package substrates or printed circuit boards.